package com.gitee.wsl.flowing.sink

import kotlinx.io.IOException

interface Sink<T>{
    /** Removes `byteCount` bytes from `source` and appends them to this.  */
    @Throws(IOException::class)
    fun write(source: T, byteCount: Long)

    /** Pushes all buffered bytes to their final destination.  */
    @Throws(IOException::class)
    fun flush()

    /** Returns the timeout for this sink.  */
    fun timeout(): Timeout = Timeout.NONE
}


open class Timeout {
    companion object {
        /**
         * An empty timeout that neither tracks nor detects timeouts. Use this when timeouts aren't
         * necessary, such as in implementations whose operations do not block.
         */
        val NONE: Timeout = Timeout()
    }
}
